﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Api.Filter;
using Customer.Bussiness_Service;
using Entity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ServiceCore; 

namespace Customer.Areas.RK.Controllers
{
    [ApiController, Area("RK"), Route("/[area]/[action]")]
    public class RKController : ControllerBase
    { 
        private readonly Irk_data_service _service;
        private readonly IToole_DI _tool;

  
        public RKController(Irk_data_service service, IToole_DI tool)
        {
            _service = service;
            _tool = tool;
        }    
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultListModel<search_rk_userlist> get_user_pagelist(search_customer_list query)
        {
            var result = _service.get_user_pagelist(query);
            return result;
        }
        /// <summary>
        /// 获取对应用户机器ID
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultListModel<search_rk_mchlist> get_mch_pagelist(Base_List_Params query)
        {
            var result = _service.get_mch_pagelist(query);
            return result;
        }
        /// <summary>
        /// 设置用户微信 联系电话信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultModel reset_user_info(reset_user_info_params model)
        {
            var resulst = _service.reset_user_info(model);
            return resulst;
        }
        /// <summary>
        /// 设置机器图片
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultModel set_mch_pic(set_mch_pic_parmas model)
        {
            var resulst = _service.set_mch_pic(model);
            return resulst;
        }
        /// <summary>
        /// 设置机器开始质保时间以及机器类型
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultModel set_mch_base(set_mch_parmas model)
        {
            var resulst = _service.set_mch_base(model);
            return resulst;
        }
        /// <summary>
        /// 获取机器枚举类型
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultModel enum_list([FromBody]List<string> enums)
        {
            var resulst = _tool.GetEnum(enums);
            return resulst;
        }


         
        /// <summary>
        /// 查询机器列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultListModel<search_rk_adminmchlist> get_adminmch_pagelist(admin_mch_params model)
        {
            var resulst = _service.get_adminmch_pagelist(model);
            return resulst;
        }
        /// <summary>
        /// 设置机器亮度
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet, Customer_Admin]
        public ResultModel set_brightness(string mchid, decimal value)
        {
            var resulst = _service.set_brightness(mchid, value);
            return resulst;
        }
        /// <summary>
        /// 提交设置亮度
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet]
        public ResultModel sub_brightness(string mchid, decimal value)
        {
            var resulst = _service.sub_brightness(mchid, value);
            return resulst;
        } 
        /// <summary>
        /// 执行指定指令
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet, Customer_Admin]
        public ResultModel run_cmd(string action, string mchid)
        {
            var resulst = _service.run_cmd(action, mchid);
            return resulst;
        }
        /// <summary>
        /// 确定指令发送完成
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet]
        public ResultModel confirm_cmd(string cmd_id, string remark)
        {
            var resulst = _service.confirm_cmd(cmd_id, remark);
            return resulst;
        }
        /// <summary>
        /// 查询指令执行日志
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultListModel<SearchMch_CMD_Log> Get_MchCmdLog_List(CMDLog_List_Params model)
        {
            var resulst = _service.Get_MchCmdLog_List(model);
            return resulst;
        }
        /// <summary>
        /// 统计查询机器图片上传情况
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultListModel<customer_repair_showpic_ForexcelPage> get_customer_pic_for_excel(search_customer_pic_for_excel model)
        {
            var resulst = _service.get_customer_pic_for_excel(model);
            return resulst;
        }

        /// <summary>
        /// 统计查询机器图片上传情况
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public void down_customer_pic_for_excel([FromForm]search_customer_pic_for_excel model)
        {
            _service.down_customer_pic_for_excel(model);
        } 
        /// <summary>
        /// 统计查询机器图片上传情况
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost, Customer_Admin]
        public ResultListModel<SearchRK_Lock_Log> get_lock_list(lock_List_Params query)
        {
            var resulst = _service.get_lock_list(query);
            return resulst;
        }
    }
}